import java.util.*;

/**
 * @author LKQ
 * @date 2022/6/15 10:04
 * @description 最长回文子串问题
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String t = sc.nextLine();
            char[] T = t.toCharArray();
            int max = 0, n = t.length();
            for (int i = 0; i < n; i++) {
                int len1 = expandCenter(T, i, i);
                int len2 = expandCenter(T, i, i + 1);
                max = Math.max(max, Math.max(len1, len2));
            }
            System.out.println(max);
        }
        sc.close();
    }

    public static int expandCenter(char[] T, int left, int right) {
        while (left >= 0 && right < T.length && T[left] == T[right]) {
            --left;
            ++right;
        }
        return right - left - 1;
    }
}
